package ch.fusun.baron.coatofarms.ui;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

import ch.fusun.baron.coatofarms.ui.background.DiagonallyDownDividedBackground;

/**
 * Test class
 */
public class Starter {

	/**
	 * @param args
	 *            glug
	 */
	public static void main(String[] args) {
		Display display = new Display();
		final Shell shell = new Shell(display);
		shell.setLayout(new GridLayout());

		CoatOfArmsData coa = new CoatOfArmsData(
				new DiagonallyDownDividedBackground(COAColor.AZURE,
						COAColor.ARGENT), new COAForeground() {

					@Override
					public void drawForeground(GC gc) {
						// Do nothing
					}
				});

		CoatOfArmsViewer viewer = new CoatOfArmsViewer(shell, SWT.None);
		viewer.setCoatOfArms(coa);
		viewer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

		shell.setText("Configure a coat of arms"); //$NON-NLS-1$
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		display.dispose();
	}
}
